<div class="pageheader">
            <h1 class="pagetitle">类型编辑</h1>
            <span class="pagedesc"></span>
        </div><!--pageheader-->
        
        <div id="contentwrapper" class="contentwrapper">
        	
        	<div id="basicform" class="subcontent">
                    
					<form class="stdform stdform2"  METHOD="POST" id="goodstype" onsubmit="return false">
						<p>
							<label>主类型</label>
							<span class="field">
								<select name="parent_id" class="uniformselect">
	                                <#if parent??>
	                                	<option value="${parent.id}">${parent.name}</option>
	                                <#else>
	                                	<option value="0">无</option>
	                                </#if>
	                            </select>
							</span>
						</p>
                    	<p>
                        	<label>名称</label>
                            <span class="field"><input type="text" name="name" id="firstname2" class="longinput"/></span>
                        </p>
                        
                        <p class="stdformbutton">
                        	<button class="stdbtn">确定</button>
                        </p>
                    </form>
					
                    <br />

            </div><!--subcontent-->
<script>
	jQuery(".stdbtn").click(function(){
	     jQuery.ajax({  
	          url: '${request.contextPath}/admin/goods/typeupdate' ,  
	          type: 'POST',  
	          data: jQuery( "#goodstype" ).serialize(), 
	          success: function (returndata) {  
	              if(returndata=="saveerror"){
	              		alert("保存失败");
	              }else if(returndata=="success"){
	              	alert("保存成功");
	              }
	          },  
	          error: function (returndata) {  
	              alert(returndata);  
	          }  
	     });  
	})
	<#if goodsType??>
		var goods = ${goodsType}
		jQuery("select[name='parent_id']").val(goods.parent_id).attr("disabled","disabled")
		jQuery("input[name='name']").val(goods.name);
		var ins = '<input type="hidden" value="'+goods.id+'" name="id"/>';
		jQuery("#goodstype").append(ins);
	</#if>
</script>